<?php

	include('cms.php');
	
	header('Content-Type: text/html; charset=UTF-8');
	
	if( isset($_GET['idcontent']) ){
		
		echo json_encode( DataLatte::arrayof('Comment', 
			"SELECT * 
			 FROM cmsComment 
			 WHERE cmsContent_idcontent = '" . $_GET['idcontent'] . "' 
			 ORDER BY created DESC") );
		
	}elseif( isset($_POST['ban']) ){
		
		DataLatte::update("UPDATE cmsComment SET deleted = 1 WHERE idcomment = '" . $_POST['ban'] . "'");
		echo OK;
		
	}elseif( isset($_POST['unban']) ){
		
		DataLatte::update("UPDATE cmsComment SET deleted = 0 WHERE idcomment = '" . $_POST['unban'] . "'");
		echo OK;
		
	}

?>